// 这里向服务器发送请求
// import request from '@/utils/request'
import axios from 'axios'
// export const getGptResponse = async (messages) => {
//   return await request.post('/gpt/help', messages)
// }
const access_token = '24.fde72a015dcfe071e1965a0eeff89d70.2592000.1715738089.282335-53560975'
export const getGptResponse = async (messages) => {
  let result = null
  await axios({
    method: 'post',
    url: `https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions?access_token=${access_token}`,
    data: messages,
    headers: {
      'Content-Type': 'application/json'
    }
  }).then(res => {
    console.log(res)
    result = res
  }).catch(err => {
    console.log(err)
    result = err
  })
  console.log('axios.result ===> ', result)
  return result
}
